/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.com.gestionstock.vue;

/**
 *
 * @author Axel
 */
import edu.com.gestionstock.bean.Livres;
import edu.com.gestionstock.bean.Dvd;

import javax.swing.*;
import java.awt.*;
import javax.swing.table.DefaultTableModel;
import java.awt.event.*;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.DefaultCellEditor;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;

public class PanneauAfficheStock extends JPanel
{

    String[] colonnes =
    {
        "Id", "Titre", "Genre", "Type", "Nombre", "Acteur", "Realisateur"
    };
    DefaultTableModel modele;
    public JTable tableau;

    public PanneauAfficheStock()
    {
        // final JFrame fenetre = new JFrame("Inventaire");

        JPanel panneauGrille = new JPanel(new GridLayout(1, 9, 5, 5));


        add(panneauGrille, BorderLayout.CENTER);
        add(new JScrollPane(getTableau()));

        /*
         fenetre.setSize (1024, 840);
         tableau.setBackground(Color.white);


         fenetre.show();*/
    }

    public DefaultTableModel getModele()
    {
        if ( modele == null )
        {
            modele = new DefaultTableModel(this.colonnes, 0)
            {
                /* Ceci permet que les cellules du tableau ne soient pas éditables*/
                public boolean isCellEditable(int iRowIndex, int iColumnIndex)
                {
                    return false;
                }
            };
        }
        return modele;
    }

    public JTable getTableau()
    {
        if ( tableau == null )
        {
            tableau = new JTable(this.getModele());
        }
        return tableau;
    }

    public void setModele(DefaultTableModel modele)
    {
        this.modele = modele;
    } 
}
